package com.zy.composeworld.demo.demo1.viewmodel

import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.MailOutline
import androidx.compose.material.icons.filled.Star
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.lifecycle.ViewModel

data class Category(val title: String)

data class DataType(val title: String, val icon: ImageVector)


class Demo1ViewModel : ViewModel() {
    //分类数据
    val categories by mutableStateOf(
        listOf(
            Category("思想政治"),
            Category("法律法规"),
            Category("职业道德"),
            Category("诚信自律"),
        )
    )

    //当前分类下标
    var categoryIndex by mutableIntStateOf(0)
        private set

    fun updateCategoryIndex(index: Int) {
        categoryIndex = index
    }

    //类型数据
    val types by mutableStateOf(
        listOf(
            DataType("相关咨询", Icons.Default.MailOutline),
            DataType("视频课程", Icons.Default.Star),
        )
    )

    //当前分类下标
    var typeIndex by mutableIntStateOf(0)
        private set

    fun updateTypeIndex(index: Int) {
        typeIndex = index
    }

}